/*////////////////////////////////////////////////////////////////////////
*
*  Project:      mapgen
*  Description:  Map Generator for Planet Wars at http://ai-contest.com/.
*  Author:       Copyright (C) 2010 Alexander Makodzeba
*  License:      GPLv3
*
*  This file is part of mapgen.
*
*  mapgen is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  mapgen is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with mapgen.  If not, see <http://www.gnu.org/licenses/>.
*
////////////////////////////////////////////////////////////////////////*/

#include "stdafx.h"
#include "MapGenerator.h"

//////////////////////////////////////////////////////////////////////////
// display usage to user
void PrintUsage()
{
	std:: cout << "error: wrong count of parameters." << std::endl;
	std:: cout << "usage: mapgen mapprefix mapscount symmetric playerscount playerplanetsize"
		<< " playerplanetpop minSize-maxSize minPop-maxPop minCount-maxCount minX:minY maxX:maxY"
		<< std::endl;
}

//////////////////////////////////////////////////////////////////////////
// entry point
// input parameters example:
// "map 100 1 2 5 100 1-5 10-150 20-30 1:1 20:20"
// where:
// "map"        prefix of map filename
// "100"        amount of maps to generate
// "1"          means that we want to generate symmetric map
// "2"          how many players
// "5"          player start planet production/size (number of ships produced per turn)
// "100"        player start planet population
// "1-5"        min and max values for planets production/size
// "10-150"     min and max values for neutral planets population
// "20-30"      amount of planets to generate
// "1:1"        Top-Left coordinate of the game world
// "20:20"      Bottom-Right coordinate of game world

int main(int argc, char* argv[])
{
	// check parameters count
	if(argc != 12)
	{
		PrintUsage();
		return 0;
	}

	// init randomizer
	srand((unsigned)time(0));

	// parse parameters
	MapGeneratorParams params;
	bool bParsed = params.ParseCommandLine(argc, argv);
		
	if(!bParsed)
	{
		//TODO: parse error handling
	}

	// generate maps
	MapGenerator mapCreator(params);
	mapCreator.GenerateMaps();

	return 0;
}

